package dao;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import pojo.User;
import pojo.User2;

import java.util.List;

public interface UserMapper {

    /**
     * 用户登录
     * @param username
     * @param password
     * @return
     */
    User select(@Param("username") String username ,@Param("password") String password);
    @ResultMap("userResultMap")
    User selectRegister(@Param("username") String username );

    int insertUser(@Param("id") long id,@Param("username") String username,@Param("password") String password,@Param("phone") String phone);
    @ResultMap("userResultMap")
    User selectUserId(@Param("username") String username);

    int updateUser(@Param("username") String username,
                   @Param("password") String password,
                   @Param("phone") String phone,
                   @Param("email") String email,
                   @Param("address") String address);
    @ResultMap("user2ResultMap")
    List<User2> searchUserList();

    int updateUserAdmin(
                    @Param("id") String id,
                    @Param("username") String username,
                   @Param("password") String password,
                   @Param("phone") String phone,
                   @Param("email") String email,
                   @Param("address") String address,
                    @Param("isAdmin") String isAdmin
                    );

    int deleteUserAdmin(@Param("id") long id);
}
